using System.Collections.Concurrent;

namespace Dapper.Bulk;

public static class BulkManager
{
    private static readonly ConcurrentDictionary<Type, object> _entityMappings = new();

    public static EntityMapping<T> Entity<T>() where T : class
    {
        return (EntityMapping<T>)_entityMappings.GetOrAdd(typeof(T), _ => new EntityMapping<T>());
    }

    internal static EntityMapping<T> GetMapping<T>() where T : class
    {
        return (EntityMapping<T>)_entityMappings.GetOrAdd(typeof(T), _ => new EntityMapping<T>());
    }
}